JBoss.orgCommunity Documentation

Chapter 8. SCCP

8.1. Routing Management
8.1.1. GTT Configuration
8.2. SCCP Usage
8.3. Access Point
8.4. SCCP User Part Example

The Signaling Connection Control Part (SCCP) is defined in ITU-T Recommendations Q.711-Q.716. SCCP sits on top of Message Transfer Part 3 (MTP3) in the SS7 protocol stack. The SCCP provides additional network layer functions to provide transfer of noncircuit-related (NCR) signaling information, application management procedures and alternative, more flexible methods of routing.

SCCP provides a routing function that allows signaling messages to be routed to a signaling point based on dialed digits, for example. This capability is known as Global Title Translation (GTT), which translates what is known as a global title (for example, dialed digits for a toll free number) into a signaling point code and a subsystem number so that it can be processed at the correct application.

Routing rules are configured using the Command Line Interface as explained Section 5.4, “SCCP Management”

GTT is performed in two stages. First is matching the rule and second is actual translation.

For matching the rule, the called party address global title digits are matched with <digits> configured in sccp rule create Section 5.4.1.1, “Create Rule” command above. Once the digits match actual translation is done

Matching rule

As explained in sccp rule create Section 5.4.1.1, “Create Rule” command the <digits> can be divided into sections using the "/" separate character. Each section defines set of digits to be matched. Wild card * can be used to match any digits and ? can be used to match exatcly one digit

For example Rule is to match starting 4 digits (should be 1234) and doesn't care for rest; the <digits> in the command will be 1234/*. If the Rule is such that starting 3 digits should be 123, doesn't care for other three digits but last two digits should be 78; the <digits> in the command will be 123/???/78. If digit to digit matching is needed the the <digits> in the command will be exact digits to be matched without sections.

Translation

For translation each section in <mask> defined in sccp rule create command defines how replacement operation is performed. If <mask> defines K, the originally dialed digits are kept and if <mask> defines R the digits from primary address or back address are used. The primary/backup address should always define the point code and the translated address will always have this point code. If the primary/backup address defines the subsystem number the translated address will also have this subsystem number. The address-indicator of translated address is always from primary/backup address. See bellow examples

The instance of org.mobicents.protocols.ss7.sccp.SccpStack acts as starting point. All the sccp messages sent by SCCP User Part are routed as per the rule configured in Router

The SCCP User Part gets handle to SccpStack by doing JNDI look-up as explained in Section 8.3, “Access Point”

SccpStack exposes org.mobicents.protocols.ss7.sccp.SccpProvider that interacts directly with SccpStack. This interface defines the methods that will be used by SCCP User Part to send org.mobicents.protocols.ss7.sccp.message.SccpMessage and register org.mobicents.protocols.ss7.sccp.SccpListener's to listen for incoming SCCP messages.

SCCP User Part registers SccpListener for specific local subsystem number. For every incoming SccpMessage, if the called subsystem matches with this local subsystem, the corresponding SccpListner is called.

SccpProvider also exposes org.mobicents.protocols.ss7.sccp.message.MessageFactory and org.mobicents.protocols.ss7.sccp.parameter.ParameterFactory to create new concrete SccpMessage viz., org.mobicents.protocols.ss7.sccp.message.UnitData or org.mobicents.protocols.ss7.sccp.message.XUnitData passing the corresponding parameters created by leveraging ParameterFactory.

SS7 Service provides user with access point to SCCP protocol/stack.

To get handle to SccpStack do the JNDI look-up passing the JNDI name configured in SS7 service as explained in Section 3.4.5, “Configuring SS7Service”

    

        private static SccpProvider getSccpProvider() throws NamingException {
    
            // no arg is ok, if we run in JBoss
            InitialContext ctx = new InitialContext();
            try {
                String providerJndiName = "/mobicents/ss7/sccp";
                return ((SccpStack) ctx.lookup(providerJndiName)).getSccpProvider();
    
            } finally {
                ctx.close();
            }
        }
            
        

Below is SCCP User Part example listening for incoming SCCP message and sending back new message



public class Test implements SccpListener {
    private SccpProvider sccpProvider;
    private SccpAddress localAddress;
    private static SccpProvider getSccpProvider() throws NamingException {
        // no arg is ok, if we run in JBoss
        InitialContext ctx = new InitialContext();
        try {
            String providerJndiName = "/mobicents/ss7/sccp";
            return ((SccpStack) ctx.lookup(providerJndiName)).getSccpProvider();
        } finally {
            ctx.close();
        }
    }
    public void start() throws Excetpion {
        this.sccpProvider = getSccpProvider();
        int translationType = 0;
        int subSystemNumber = 0;
        GlobalTitle gt = GlobalTitle.getInstance(translationType,
                NumberingPlan.ISDN_MOBILE, NatureOfAddress.NATIONAL, "1234");
        localAddress = new SccpAddress(gt, 0);
        this.sccpProvider.registerSccpListener(localAddress, this);
    }
    public void stop() {
        this.sccpProvider.deregisterSccpListener(localAddress);
    }
    public void onMessage(SccpMessage message) {
        if (message.getType() == MessageType.UDT) {
            throw new IlleagalArgumentException("Dont like UDT");
        } else if (message.getType() == MessageType.XUDT) {
            XUnitData xudt = (XUnitData) message;
            localAddress = ((XUnitData) message).getCalledPartyAddress();
            SccpAddress remoteAddress = ((XUnitData) message)
                    .getCallingPartyAddress();
            // now decode content
            byte[] data = xudt.getData();
            // some data encoded in
            CallRequest cr = new CallRequest(data);
            byte[] answerData;
            if (cr.getCallee().equals(this.localAddress)) {
                EstablihsCallAnswer eca = new EstablihsCallAnswer(cr);
                answerData = eca.encode();
            } else {
                TearDownCallAnswer tdca = new TearDownCallAnswer(cr);
                answerData = tdca.encode();
            }
            HopCounter hc = this.sccpProvider.getParameterFactory()
                    .createHopCounter(5);
            XUnitData sccpAnswer = this.sccpProvider
                    .getMessageFactory()
                    .createXUnitData(hc, xudt.getProtocolClass(),
                            message.getCallingPartyAddress(), this.localAddress);
            this.sccpProvider.send(sccpAnswer);
        }
    }
}